﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataLib.Common;
using System.Data;
using Microsoft.Reporting.WebForms;
using Ewts.Code;

namespace Ewts.RDLC
{
    public partial class SaleOutstorageSltRDLC : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                SaleOutStorageReportView.LocalReport.EnableHyperlinks = true;

            }
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            this.SaleOutStorageReportView.Visible = true;  //设置页面visible：false,点击查询后为true  2013.04.17 梁玲
            string loadnum = txtLoadnum.Text;
            string outStorageNO = txtOutStorageNo.Text;
            string startdate = txtTime1.Text;
            string enddate = txtTime2.Text;
            string customer = txtCum.Text;
            string gCode = txtGoodsCode.Text;
            string gName = txtGoodsName.Text;
            string position = txtPosition.Text;
            string barcode = txtBarCode.Text;
            string ConsumMan = txtConsumMan.Text;
            string boxid = txtBOXID.Text;
            string saleno = txtSaleNo.Text;
            string Do = txtDO.Text;

            if ((!PageValidate.IsDateTime(startdate) && PageValidate.IsDateTime(enddate)) || ((PageValidate.IsDateTime(startdate) && !PageValidate.IsDateTime(enddate))))
            {
                MessageBox.Show(this, "日期格式不合法，时间段填写完整！");
                return;
            }


            DataLib.BLL.OutStorage bll = new DataLib.BLL.OutStorage();

            DataTable dt = bll.getDtByUnionWhere("", loadnum, outStorageNO, "",
                gCode, startdate, enddate, barcode, ConsumMan, boxid, customer, "4", gName,position);

            ReportDataSource rds = new ReportDataSource("SaleOutstorageSltDS", dt);
            SaleOutStorageReportView.LocalReport.DataSources.Clear();
            SaleOutStorageReportView.LocalReport.DataSources.Add(rds);
            new RDLCPrinter().FillRow(dt, 3, 20, 20);
            SaleOutStorageReportView.LocalReport.Refresh();
        }
    }
}